package com.blog.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author cgx
 * @Date 2021/12/1 17:46
 */
@Configuration
public class ResourcesConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //配置静态资源路径，所有来自/upload/的静态请求，都会到resource下的/upload/
        registry.addResourceHandler("/upload/**").addResourceLocations("classpath:/upload/");
    }
}
